Skip to content

Allow for changing pull ups for Wire pins #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 2, 2020
Merged

Allow for changing pull ups for Wire pins #103

merged 6 commits into from
Jan 2, 2020

Conversation

nseidle
Copy link
Member

@nseidle nseidle commented Jan 1, 2020

I've added a setPullups() function. This allows users to select between 0, 1.5k, 6k, 12k, and 24k, for the built in pull ups on the I2C lines. Because we call begin() after user selects their pull up values, I needed to store clock speed.

I addition, I moved the iomTransfer setup of default values to the begin function. This was done for SPI as well to decrease the amount of cycles spent setting up values for every I2C transfer. It won't save as much time as the SPI change did, but it will cut it down a bit. It does increase RAM footprint by the size of iomtransfer but I'm not worried about it.

I chose to allow user to pass a uint32_t to the setPullups() function. If desired, we could pass the full HAL type def of am_hal_gpio_pullup_e but I think it's easier to use a bare number.

@oclyke
Copy link
Contributor

oclyke commented Jan 2, 2020

I think it looks good - there are pros / cons either way you choose (regarding what type to use for setPullups) so I am fine with this way. Maybe we should consider it a standard (passing the most flexible type rather than stricter types).

@oclyke oclyke merged commit 6b27290 into master Jan 2, 2020
@oclyke oclyke deleted the WirePullups branch January 2, 2020 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants